package com.lmscn.lms.api.model;

import com.jfinal.plugin.activerecord.Model;

import java.util.Date;
import java.util.List;

/**
 * Created by xiaojie on 15-11-11.
 */
public class LoginCount extends Model<LoginCount>{

    public static final LoginCount dao = new LoginCount();


    public  void save(LoginCount loginCount,String phone,String name,Long userId,Date time){
        loginCount.set("uuid",phone);
        loginCount.set("login_time",time);
        loginCount.set("user_name",name);
        loginCount.set("user_id",userId);
        loginCount.remove("id").save();
    }

    public LoginCount findByUserName(String username){
        return  dao.findFirst("select * from  t_login_count where user_name = ?",username);
    }
    public LoginCount findByUserNameAndUUID(String username, String uuid){
        return  dao.findFirst("select * from  t_login_count where user_name = ? and uuid = ?",username,uuid);
    }
}
